import {Map,List,fromJS} from 'immutable';

const initialState = fromJS({
  loading : false,
  license : true
});

export default (state = initialState, action) => {

  if (action.type === 'app_license') {
    return state.set('license',action.status);
  }

  if (action.type === 'app_installed') {

    return state.merge({
      license : true,
      installed : action.status
    })

    // return state.set('installed',action.status);
  }

  if (action.type === 'app_userinfo') {
    return state.set('userinfo',action.userinfo);
  }

  if (action.type === 'app_loading') {
    return state.set('loading',action.status);
  }
  
  return state;
};